﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Javu2DExamples;
using Javu2D;
namespace JavuExampleViewer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            JavuExamples.List.ForEach( (item)=>{
                mExampleList.Items.Add(item.GameName);
            }); ;
        }
        public JavuGame ActiveGame = null;
        private void mExampleList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (mExampleList.SelectedIndices.Count == 0)
            {
                mGameInfo.Text = "";
                ActiveGame = null;
                return;
            }
            
            ActiveGame = JavuExamples.List.Item[mExampleList.SelectedIndices[0]];
            mGameInfo.Text = ActiveGame.GameInfo + "\n" + ActiveGame.CopyrightInfo;
         
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (ActiveGame == null) return;
            ActiveGame.StartGame();
            
        }
    }
}
